package pda.agenda;

import pda.base.IApplication;
import pda.base.IPda;

import java.awt.event.MouseAdapter;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.event.MouseEvent;
import javax.swing.JPanel;


public class Agenda extends MouseAdapter implements ActionListener, IApplication  {

		
	public void actionPerformed(ActionEvent e){
	
		String evt = e.getActionCommand ();

		if (evt.equals ("home")) {
			view.getMenu().setVisible (true); 
			int posXpopup = 0; 
			int posYpopup = - (view.getMenu().getHeight ()); 
			view.getMenu().show (view.getOptions(),posXpopup, posYpopup); 
		}else if (evt.equals("prevMonth")){
			view.changeSubMonth();
		}else if(evt.equals("nextMonth")){
			view.changeAddMonth();
		}else if (evt.equals("addCourse")){
			view.setPanelCourse();
		}else if(evt.equals("addRdv")){
			view.setPanelRdv();
		}else if(evt.equals("addMeeting")){
			view.setPanelMeeting();
		}else if(evt.equals("addActivity")){
			view.setPanelActivity();
		}else if(evt.equals("prevDay")){
			view.changeSubDay();
		}else if(evt.equals("nextDay")){
			view.changeAddDay();
		}else if(evt.equals("retour")){
			view.initHome();
		}else if(evt.equals("validRDV")){
			
		}else if(evt.equals("validReunion")){
			
		}else if(evt.equals("validCours")){
			
		}else if(evt.equals("validActivite")){
			
		}else{
		}
		
	}
	
	public void mouseClicked(MouseEvent mouseEvent){
		view.initInternalFrame();
	}
	
	
	public boolean getEvt(int day, int month, int year){
		return engine.getEvt(day, month, year);
	}
	public String getEvt(String date){
		return engine.getEvt(date);
	}
		
		
	
//##########################################################################################################
//										Declaration des variables
//##########################################################################################################
	/** the name of the application */
    protected String name = "Agenda";
    /** the view of the application */
    protected AgendaView view;
    /** the engine of the application */
    protected AgendaEngine engine;

//##########################################################################################################
//										Methodes natives (non modifier)
//##########################################################################################################
    /**
     *  The Agenda constructor
     */
    public Agenda() {
        engine = new AgendaEngine();
        view = new AgendaView(this);
    } 
   
    public void start(IPda pda) {
        view.launchAgendaView();
    } 
	
    public String getAppliName() {
		return name;
    } 
	
    public JPanel getAppliPanel() {
		return view.getPanel();
    }
	
    public boolean close() {
		return true;
    } 
} 
